Carbon


CompareString

Header: StringCompare.h Carbon status: Supported

Compares two Pascal strings, making use of the string comparison information from a resource that you specify as a parameter.

SInt16 CompareString (
    ConstStr255Param aStr, 
    ConstStr255Param bStr, 
    Handle itl2Handle
);
Parameter descriptions
aStr

One of the Pascal strings to be compared.

bStr

The other Pascal string to be compared.

itl2Handle

The handle to the string-manipulation resource that contains string comparison information. If the value of this parameter is NULL, CompareString makes use of the resource for the current script. The string-manipulation resource includes functions and tables for modifying string comparison and tables for case conversion and stripping of diacritical marks.

function result

Returns –1 if the first string is less than the second string, 0 if the first string is equal to the second string, and 1 if the first string is greater than the second string.

DISCUSSION

This function takes both primary and secondary sorting orders into consideration and returns a value that indicates the sorting order of the first string relative to the second string.

SPECIAL CONSIDERATIONS

CompareString may move memory; your application should not call this function at interrupt time.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)